package dao;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;

import pojo.RegisterBean;

@Repository
public class MyDao {
	
	HibernateTemplate template;

	
	SessionFactory sessionFactory;
	
	public void setTemplate(HibernateTemplate template) {
		this.template = template;
	}


	public void saveUser(RegisterBean registerBean){
		
	template.save(registerBean);
	}
	
//***********************************************************************************************	
	
	
	
	public void getList(){
		System.out.println("MyDao.getList()");
		String hql="from StudentList stud";
		Session session=sessionFactory.openSession();
		Query query=session.createQuery(hql);
		List<Object> list=query.list();
		for(Object obj:list){
			Object objarr=(Object)obj;
			System.out.println("Zero :"+objarr);
		}
	}


	public SessionFactory getSessionFactory() {
		return sessionFactory;
	}


	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}


	
	

	

}
